package cn.walls1717.juc.interrupt;

import lombok.extern.slf4j.Slf4j;

/**
 * interrupted测试
 *
 * @author walls1717
 * @create 2022/12/10 13:32
 **/
@Slf4j
public class Interrupt4Demo {

    public static void main(String[] args) throws InterruptedException {

        // interrupted方法会先返回当前线程的中断标志，然后再将当前的中断标志设置为false。
        log.info("中断状态 -> {}", Thread.interrupted());
        log.info("中断状态 -> {}", Thread.interrupted());
        log.info("----------------");
        Thread.currentThread().interrupt();
        log.info("----------------");
        log.info("中断状态 -> {}", Thread.interrupted());
        log.info("中断状态 -> {}", Thread.interrupted());
    }
}
